#include "Operator.h"

#include <string.h>
#include <fan-llvm/core/Core.h>
#include "Type.h"
#include "UnsupportedErr.h"


Type* Operator_classType = NULL;
VTable* Operator_classVTable = NULL;


/**********************************************
 *
 * Methods and fields
 *
 **********************************************/


/* Operator defVal */
Operator* Operator_defVal(void)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Operator.defVal not implemented yet"));
}


/**********************************************
 *
 * Type-system functions
 *
 **********************************************/


Type* Operator_initType(void)
{
  if (Operator_classType == NULL)
  {
    Type* baseType = Obj_initType();
    VTable* vtable = Operator_initVTable();
    Type* type = Type_new("Operator", baseType, vtable, sizeof(Operator), sizeof(OperatorVTable));
    Type_registerFieldImplementation(type, "defVal", Operator_defVal, NULL);
    Operator_classType = type;
    Operator_initStatic();
  }
  return Operator_classType;
}


VTable* Operator_initVTable(void)
{
  if (Operator_classVTable == NULL)
  {
    VTable* vtable = memoryAlloc(sizeof(OperatorVTable));
    memcpy(vtable, Obj_initVTable(), sizeof(FanObjVTable));
    Operator_classVTable = vtable;
  }
  return Operator_classVTable;
}


void Operator_initStatic(void)
{
}
